import requests



class SendApirequests(object):

    def __init__(self):
        self.session = requests.session()

    def request_Obj(self, method, url, params=None, data=None, json=None, files=None, headers=None,):
        try:
            opetype = str.lower(method)
            if opetype == 'get':
                response = requests.get(url=url, params=params, headers=headers)
            elif opetype == 'post':
                response = requests.post(url=url, json=json, data=data, files=files, headers=headers)
            elif opetype == 'delete':
                response = requests.delete(url=url, json=json, data=data, files=files, headers=headers)
            elif opetype == 'put':
                response = requests.put(url=url, json=json, data=data, files=files, headers=headers)
            return response
        except Exception as e:
            print(params)
            print(data)
            print(json)
            print(headers)
            raise e

